package DatingApp;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.MainScreen;

public class ControlPanel extends MainScreen implements FieldChangeListener{

	ButtonFrames frames;
	public ControlPanel(){
		
		this.frames = new ButtonFrames();
		this.createLayout();
		
		
	}
	
	/**
	 * Creates the layout of the control panel screen. 
	 */
	public void createLayout(){
		setTitle("Control Panel");
		
		ButtonField test = new ButtonField("hello");
		test.setChangeListener(this);
		frames.getProfile().setChangeListener(this);
		frames.getProfile2().setChangeListener(this);
		frames.getNotifications().setChangeListener(this);
		frames.getNotifications2().setChangeListener(this);
		
		add(frames.getTopFrame());
		add(test);
		add(frames.getBottomFrame());
		
	}
	
	/**
	 * Implements field change listener.
	 */
	public void fieldChanged(Field field, int context) {
		
		if (field == frames.getProfile() || field == frames.getProfile2()){
			UiApplication.getUiApplication().pushScreen(new Profile());
		}else if (field == frames.getNotifications() || field == frames.getNotifications2()){
			UiApplication.getUiApplication().pushScreen(new Notifications());
		}
			
		//this.close();
		
	}

}
